//
//  RMineHeader.m
//  Riji
//
//  Created by liujianlong on 2022/8/17.
//

#import "RMineHeader.h"
@interface RMineHeader()
@property (strong, nonatomic) IBOutlet UIImageView *img;
@property (strong, nonatomic) IBOutlet UILabel *name;
@property (strong, nonatomic) IBOutlet UILabel *account;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *accountTop;



@end
@implementation RMineHeader

- (void)setUser:(RUserModel *)user{
    _user = user;
    if (user == nil) {
        self.img.image = [UIImage imageNamed:@"头像"];
        self.name.text = @"";
        self.account.text = LS(@"注册/登录");
    }else{
        [UIImage imageWithURL:user.headImg block:^(UIImage * _Nonnull image) {
            self.img.image = image == nil ? [UIImage imageNamed:@"头像"] : image;
        }];
        
        self.name.text = user.username;
        self.account.text = [user.ID isEqualToString:LS(@"未知用户")] ? LS(@"注册/登录") : user.ID;
    }
}

@end
